org.jboss.byteman.agent
Class ScriptRepository

java.lang.Object
  extended by org.jboss.byteman.agent.ScriptRepository

public class ScriptRepository
extends java.lang.Object

Class to manage indexing and lookup of rule scripts by rule name and by either class or interface name


Constructor Summary
ScriptRepository(boolean skipOverrideRules)
           
 
Method Summary
 RuleScript addScript(RuleScript script)
          add a rule script to the repository returning any existing script with the same name or null if no such script can be found.
 boolean checkInterfaces()
          see if we need to do any transformation of interfaces
 java.util.List<RuleScript> currentRules()
          return a list containing all the currently installed rule scripts.
 boolean matchClass(java.lang.Class<?> clazz)
          return true if there is a rule which applies to the supplied class otherwise false
 java.util.List<RuleScript> processScripts(java.lang.String scriptText, java.lang.String scriptFile)
          Split the text of a script file into a list of individual rule scripts
 RuleScript removeScript(RuleScript script)
          remove a rule script from the repository returning the script if it is found or null if is not found.
 RuleScript removeScript(java.lang.String name)
          remove a rule script from the repository by name returning the script if it is found or null if is not found.
 RuleScript scriptForRuleName(java.lang.String name)
          locate a rule script with a given name
 java.util.List<RuleScript> scriptsForClassName(java.lang.String name)
          return a list of all class scripts indexed using the supplied name.
 java.util.List<RuleScript> scriptsForInterfaceName(java.lang.String name)
          return a list of all interface scripts indexed using the supplied name.
 boolean skipOverrideRules()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptRepository

public ScriptRepository(boolean skipOverrideRules)
Method Detail

processScripts

public java.util.List<RuleScript> processScripts(java.lang.String scriptText,
                                                 java.lang.String scriptFile)
                                          throws java.lang.Exception
Split the text of a script file into a list of individual rule scripts

Parameters:
scriptText - the text obtained from a script file
scriptFile - teh name of the file containing teh text
Returns:
a list of rule scripts
Throws:
java.lang.Exception - if there is an error in the format of the script file tesxt

addScript

public RuleScript addScript(RuleScript script)
add a rule script to the repository returning any existing script with the same name or null if no such script can be found. if a script is returned it will have been deactivated.

Parameters:
script - the script to be added to the repository
Returns:
any previous script with the same name or null

removeScript

public RuleScript removeScript(RuleScript script)
remove a rule script from the repository returning the script if it is found or null if is not found. if a script is returned it will have been deactivated.

Parameters:
script - the script to be removed from the repository.
Returns:
the script if it was found in the repository and removed successfully or null if it had already been removed.

removeScript

public RuleScript removeScript(java.lang.String name)
remove a rule script from the repository by name returning the script if it is found or null if is not found. if a script is returned it will have been deactivated.

Parameters:
name - the name of the script to be removed from the repository
Returns:
the script if it was found in the repository or null if none was found

scriptForRuleName

public RuleScript scriptForRuleName(java.lang.String name)
locate a rule script with a given name

Parameters:
name - the name of the rule script
Returns:
the script with that name or null if no such script can be found

scriptsForClassName

public java.util.List<RuleScript> scriptsForClassName(java.lang.String name)
return a list of all class scripts indexed using the supplied name. note that if name is package qualified then only scripts with the full package qualificaton will be returned whereas if name is not package qualified then only scripts with the unqualified name will be returned. Note that the returned list can be iterated safely but will not reflect later additions to or deletions from the list.

Parameters:
name -
Returns:

scriptsForInterfaceName

public java.util.List<RuleScript> scriptsForInterfaceName(java.lang.String name)
return a list of all interface scripts indexed using the supplied name. note that if name is package qualified then only scripts with the full package qualificaton will be returned whereas if name is not package qualified then only scripts with the unqualified name will be returned. Note that the returned list can be iterated safely but will not reflect later additions to or deletions from the list.

Parameters:
name -
Returns:

matchClass

public boolean matchClass(java.lang.Class<?> clazz)
                   throws java.lang.Exception
return true if there is a rule which applies to the supplied class otherwise false

Parameters:
clazz -
Returns:
Throws:
java.lang.Exception

currentRules

public java.util.List<RuleScript> currentRules()
return a list containing all the currently installed rule scripts.

Returns:

checkInterfaces

public boolean checkInterfaces()
see if we need to do any transformation of interfaces

Returns:

skipOverrideRules

public boolean skipOverrideRules()


Copyright © 2012. All Rights Reserved.